package com.teame.readbaby.dao;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class AddressDao {

	public static final String path = "/data/data/com.teame.readbaby/files/citydatabase.db";
	
	public AddressDao() {
		
	}

	public String getCityName(String cityId,String areId){
		
		SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null,
				SQLiteDatabase.OPEN_READONLY);
		Cursor cs = db.rawQuery("select cant_name from pub_cant where cant_code= ?", new String[]{cityId});
		String str="";
		if(cs.moveToFirst()){
			str+=cs.getString(0);
		}
		cs.close();
		Cursor cs2 = db.rawQuery("select cant_name from pub_cant where cant_code= ?", new String[]{areId});
		if(cs2.moveToFirst()){
			str+=cs2.getString(0);
		}
		cs2.close();
		db.close();
		return str;
	}

	public String getAreaid(String province, String city, String area) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getAreaid(String cityid) {
		
		SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null,
				SQLiteDatabase.OPEN_READONLY);
		Cursor cs = db.rawQuery("select cant_name from pub_cant where cant_code= ?", new String[]{cityid});
		String s="";
		if(cs.moveToFirst()){
			s=cs.getString(0);
		}
		cs.close();
		db.close();
		return s;
	}
	
}
